//
//  NSString+YXJHeight.m
//  Piece
//
//  Created by dllo on 16/6/14.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "NSString+YXJHeight.h"

@implementation NSString (YXJHeight)

- (CGRect)heightForStringBySize:(CGSize)size AttributeDic:(NSDictionary *)dic
{
    //得到新的frame
    CGRect newRect = [self boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return newRect;
}

- (NSString *)changeFormString:(NSString *)string
{
    NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
    [inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
    [inputFormatter setDateFormat:@"yy-MM-dd HH:mm:ss"];//yyyyMMddHHmmss
    
    NSDate *inputDate = [inputFormatter dateFromString:string];
    
    NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
    [outputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
    [outputFormatter setDateFormat:@"MMM.dd,yyyy"];
    
    NSString *outputDate = [outputFormatter stringFromDate:inputDate];
    return outputDate;
}


@end
